<?php

$__FILEPATH__ = dirname(__FILE__)."/";

require_once($__FILEPATH__."../func_common.php");
require_once($__FILEPATH__."../class_def.php");
require_once($__FILEPATH__."../conf/info.php");
CheckAdminAndInitHeader();
$mysqli = GetMysqliInstance();

if (isset($_POST["algo_dele"]))
{
	if (!isset($_POST["id"]))
		die("非法操作~");
	$id = intval($_POST["id"]);
	if ($mysqli->query("update bclinklist set cid = 0 where cid = $id")
		&& $mysqli->query("delete from classlist where id = $id"))
	{
		ClientAlert("删除成功~");
	}
	else die("系统出错~");
}


$ClassArray = array();

$result = $mysqli->query("select id,name,cnt from classlist where type='algorithm'");

if ($result)
{
	while($row = $result->fetch_array(MYSQLI_ASSOC))
	{
		$ClassItem = new ClassListItem();
		$ClassItem->id = $row["id"];
		$ClassItem->name = $row["name"];
		$ClassItem->cnt = intval($row["cnt"]);
		$ClassArray[] = $ClassItem;
	}

	$result->close();
}

$mysqli->close();

?>